<?php
require_once("config.php");

class GalInfo
{
    var $count;
    var $items;

    function GalInfo($count, $items)
    {
        $this->count = $count;
        $this->items = $items;
    }
}

if ($_SERVER['REQUEST_METHOD'] == "GET") {

    $select = "SELECT
a.Article article,
a.Weight weight,
a.Size size,
a.Price price,
a.Status status,
c.`Металл` metal,
d.Name name,
f.`Вставка` ins
FROM
    titems_internet a
        inner join
    tmatchingphotos b ON a.Article = b.linkArticle
        inner join
    tconstme c ON a.Me = c.id
        inner join
    tconstnames d ON d.id = a.Name
        inner join
    tindexvstavki e ON a.Article = e.linkArticle
        inner join
    tconstgroupvstavki f ON e.linkgroupvstavka = f.id
where
a.Article = '9-1-114=1-1'";

    $r = mysql_query($select,$link);

    for($i = mysql_num_rows($r); $i > 0 ; $i--) {
        $content[] = mysql_fetch_assoc($r);
    }
//    $searchMenu=new SearchMenu();
//    $searchMenu->stone=$content;
//    print_r($content[0]);
//$arr=array_map( create_function('$person', 'return $person;'),$content);
//    transpose($content,$arr);
//    print_r($arr);
//    foreach($content as $obj){
//
//        foreach($obj as $key => $value){
//
//        }
//    }


    array_unshift($content, null);
    $content = call_user_func_array("array_map", $content);

//    print_r($content);

//    echo json_encode($content);
} /** UPDATE or DELETE **/
else if (array_key_exists("_method", $_POST)) {
    // Don't bother doing anything here. We don't really need it for the demo
} /** CREATE **/
else {
    // Just return a model. Don't bother actually creating it and returning the new record
    $data = array("id" => 1, "name" => "Joe Zim", "age" => 23);
    // Encode it as JSON and ship it back
    echo json_encode($data);
}




?>
